import privateKey from './private.pem';

const JSEncrypt = require('node-jsencrypt');
const encrypt = new JSEncrypt();
// 使用约定解密私钥
encrypt.setPrivateKey(privateKey);

// 生成公钥
// encrypt.getPublicKeyB64();
// 生成私钥
// encrypt.getPrivateKeyB64()

// 加密
// encrypt.encrypt(base64 string);
// 解密
// encrypt.decrypt(string);

// 解密
const decrypt = (data: string) => {
  return encrypt.decrypt(data);
};

export {
  decrypt,
};